home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / DOS / PRGMMING / CPP100.ZIP / CPPLME10.C < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-22  |  10.7 KB  |  347 lines

  1. /*****************************************************************************/
  2. /*       (C) 1993,1994 R. NADE - M. GRANDCHAMP - All Rights Reserved         */
  3. /*****************************************************************************/
  4. /*    This source-code is NOT public domain nor Freeware, this is part of    */
  5. /*              'The C Programming Package' which is Shareware.              */
  6. /*   If you use this code, please register and get a free Full-VGA version   */
  7. /*****************************************************************************/
  8.                             /*----------------*
  9.                              *   CPPLME10.C   *
  10.                              *  Help manager  *
  11.                              *----------------*/
  12.  
  13.  /* Included Files */
  14.  # include <stdio.h>
  15.  # include <io.h>
  16.  # include <dos.h>
  17.  # include <fcntl.h>
  18.  # include <bios.h>
  19.  # include <stdlib.h>
  20.  # include <conio.h>
  21.  
  22.  /* Global Variables */
  23.  extern int bm,i,j,k,l,m,n,t,x,x1,x2,xm,y,y1,y2,ym,z,menu0,menu10,return1;
  24.  extern int colour1,colour2,colour3,colour4,colour5,returning;
  25.  extern unsigned char c0,c1,trashcan[];
  26.  
  27.  /*-----------------*
  28.   * GET THE MOUSE10 *
  29.   *-----------------*/
  30.   int get_the_mouse10()
  31.     {
  32.       /* If we make a choice with the mouse */
  33.       /* only available for menu 10 */
  34.       if(ym==1){
  35.         /* we clicked on the first line */
  36.         /* certainly to change of menu */
  37.         x=get_the_mouse0();
  38.     menu0=x;                       return(-2);
  39.       }
  40.       if((xm>61)&&(xm<80)){
  41.     if(ym==3){
  42.        /* help */
  43.       menu10=1;                   return(1);
  44.     }
  45.     if(ym==4){
  46.           /* available */
  47.       menu10=2;                    return(1);
  48.     }
  49.     if(ym==5){
  50.           /* available */
  51.       menu10=3;                    return(1);
  52.     }
  53.     if(ym==7){
  54.           /* help Files menu */
  55.       menu10=4;                    return(1);
  56.     }
  57.     if(ym==8){
  58.           /* help menu2 */
  59.       menu10=5;                    return(1);
  60.     }
  61.     if(ym==9){
  62.           /* help menu3 */
  63.       menu10=6;                    return(1);
  64.     }
  65.     if(ym==10){
  66.           /* help menu4 */
  67.       menu10=7;                    return(1);
  68.     }
  69.     if(ym==11){
  70.           /* help menu5 */
  71.       menu10=8;                    return(1);
  72.     }
  73.     if(ym==12){
  74.           /* help menu6 */
  75.       menu10=9;                    return(1);
  76.     }
  77.     if(ym==13){
  78.           /* help menu7 */
  79.       menu10=10;                   return(1);
  80.     }
  81.     if(ym==14){
  82.           /* help menu8 */
  83.       menu10=11;                   return(1);
  84.     }
  85.     if(ym==15){
  86.           /* help Configuration */
  87.       menu10=12;                   return(1);
  88.     }
  89.       }
  90.       /* If we clicked outside of the menu zone */
  91.       /* we close the menu                      */
  92.       menu0=0;                         return(-2);
  93.     }
  94.  /*---------------*
  95.   * MENU CHOICE10 *
  96.   *---------------*/
  97.   int menu_choice10()
  98.     {
  99.       returning=wait_for_a_key();
  100.       /* Else we pressed a keyboard key. Cf CPPLTC2.C for the */
  101.       /* keyboard test and the returned codes                 */
  102.       if(returning==-1){
  103.         /* <Esc> we want to return to previous menu */
  104.     menu0=0;                       return(-2);
  105.       }
  106.       if(returning==40){
  107.         /* <Enter> execute the command */
  108.     return(1);
  109.       }
  110.       if(returning==100){
  111.         /* We pressed a mouse button */
  112.         m=get_the_mouse2();  return(m);
  113.       }
  114.       if(returning==16){
  115.         /* <G> <g> Generalities */
  116.     menu10=1;                       return(1);
  117.       }
  118.       if(returning==23){
  119.         /* <N> <n> Available */
  120.     menu10=2;                       return(0);
  121.       }
  122.       if(returning==28){
  123.         /* <S> <s> Available */
  124.     menu10=3;                       return(0);
  125.       }
  126.       if(returning==15){
  127.         /* <F> <f> Files menu */
  128.     menu10=4;                       return(1);
  129.       }
  130.       if(returning==2){
  131.     /* <2> Menu2*/
  132.     menu10=5;                       return(1);
  133.       }
  134.       if(returning==3){
  135.     /* <3> Menu3*/
  136.     menu10=6;                       return(1);
  137.       }
  138.       if(returning==4){
  139.     /* <4> menu4*/
  140.     menu10=7;                       return(1);
  141.       }
  142.       if(returning==5){
  143.     /* <5> menu5*/
  144.     menu10=8;                       return(1);
  145.       }
  146.       if(returning==6){
  147.     /* <6> menu6*/
  148.     menu10=9;                       return(1);
  149.       }
  150.       if(returning==7){
  151.     /* <7> menu7*/
  152.     menu10=10;                   return(1);
  153.       }
  154.       if(returning==8){
  155.     /* <8> menu8*/
  156.     menu10=11;                   return(1);
  157.       }
  158.       if(returning==12){
  159.         /* <C7> <c> menu Configuration */
  160.     menu10=12;                   return(1);
  161.       }
  162.       /* For the 2-bytes coded keys, this is the second byte */
  163.       if(returning==59){
  164.          /* Function key <F1> = help */
  165.      return(59);
  166.       }
  167.       if(returning>100){
  168.       /* If we pressed Alt + another key to get a menu */
  169.         c1=returning-100;                 k=get_special_menu00();
  170.     if(k>0)                        return(-2);
  171.       }
  172.       if((returning==77)||(returning==75)){
  173.         /* Right or Left arrow to change of menu */
  174.         c1=returning;                             k=get_special_menu00();
  175.     if(k>0)                        return(-2);
  176.       }
  177.       if(returning==72){
  178.         /* Up arrow */
  179.     if(menu10>1)                    menu10--;
  180.     else                           menu10=12;
  181.     return(0);
  182.       }
  183.       if(returning==80){
  184.         /* Down arrow */
  185.     if(menu10<12)                   menu10++;
  186.     else                           menu10=1;
  187.     return(0);
  188.       }
  189.       /* Else we return 0 = no choice */
  190.       return(0);
  191.     }
  192.  /*---------------------*
  193.   * DISPLAY MENU LINE10 *
  194.   *---------------------*/
  195.   void display_menu_line10()
  196.     {
  197.     /* First we display the choosen menu 0 */
  198.       textattr(colour5);
  199.       gotoxy(75,1);                     cputs(" Help ");
  200.       /* Same thing for the selected line */
  201.       if(menu10==1){
  202.         gotoxy(63,3);              cputs(" Generalities    ");
  203.       }
  204.       if(menu10==2){
  205.     gotoxy(63,4);                  cputs("                ");
  206.       }
  207.       if(menu10==3){
  208.     gotoxy(63,5);                  cputs("                ");
  209.       }
  210.       if(menu10==4){
  211.         gotoxy(63,7);              cputs(" Files          ");
  212.       }
  213.       if(menu10==5){
  214.     gotoxy(63,8);                  cputs(" menu2          ");
  215.       }
  216.       if(menu10==6){
  217.     gotoxy(63,9);                  cputs(" menu3          ");
  218.       }
  219.       if(menu10==7){
  220.     gotoxy(63,10);                 cputs(" menu4          ");
  221.       }
  222.       if(menu10==8){
  223.     gotoxy(63,11);                 cputs(" menu5          ");
  224.       }
  225.       if(menu10==9){
  226.     gotoxy(63,12);                 cputs(" menu6          ");
  227.       }
  228.       if(menu10==10){
  229.     gotoxy(63,13);                 cputs(" menu7          ");
  230.       }
  231.       if(menu10==11){
  232.     gotoxy(63,14);                 cputs(" menu8          ");
  233.       }
  234.       if(menu10==12){
  235.     gotoxy(63,15);                 cputs(" Configuration  ");
  236.       }
  237.     }
  238.  /*----------------------*
  239.   * DISPLAY KEY LETTER10 *
  240.   *----------------------*/
  241.   void display_key_letter10()
  242.     {
  243.       textattr(116);
  244.       gotoxy(64,3);                    cputs("G");
  245.       gotoxy(64,4);                    cputs(" ");
  246.       gotoxy(64,5);                    cputs(" ");
  247.       gotoxy(64,7);                    cputs("F");
  248.       gotoxy(68,8);                    cputs("2");
  249.       gotoxy(68,9);                    cputs("3");
  250.       gotoxy(68,10);                   cputs("4");
  251.       gotoxy(68,11);                   cputs("5");
  252.       gotoxy(68,12);                   cputs("6");
  253.       gotoxy(68,13);                   cputs("7");
  254.       gotoxy(68,14);                   cputs("8");
  255.       gotoxy(64,15);                   cputs("C");
  256.     }
  257.  /*----------------*
  258.   * DISPLAY MENU10 *
  259.   *----------------*/
  260.   void display_menu10()
  261.     {
  262.       hide_the_mouse();               textattr(colour2);
  263.       gotoxy(61,2);                    cputs(" ┌────────────────┐ ");
  264.       gotoxy(61,3);                    cputs(" │ Generalities   │ ");
  265.       gotoxy(61,4);                    cputs(" │                │ ");
  266.       gotoxy(61,5);                    cputs(" │                │ ");
  267.       gotoxy(61,6);                    cputs(" ├────────────────┤ ");
  268.       gotoxy(61,7);                    cputs(" │ Files          │ ");
  269.       gotoxy(61,8);                    cputs(" │ menu2          │ ");
  270.       gotoxy(61,9);                    cputs(" │ menu3          │ ");
  271.       gotoxy(61,10);                   cputs(" │ menu4          │ ");
  272.       gotoxy(61,11);                   cputs(" │ menu5          │ ");
  273.       gotoxy(61,12);                   cputs(" │ menu6          │ ");
  274.       gotoxy(61,13);                   cputs(" │ menu7          │ ");
  275.       gotoxy(61,14);                   cputs(" │ menu8          │ ");
  276.       gotoxy(61,15);                   cputs(" │ Configuration  │ ");
  277.       gotoxy(61,16);                   cputs(" └────────────────┘ ");
  278.       display_key_letter10();          display_menu_line10();
  279.       show_the_mouse();
  280.     }
  281.  /*----------------*
  282.   * MENU MANAGER10 *
  283.   *----------------*/
  284.   int menu_manager10()
  285.     {
  286.       restore_screen();                return1=0;
  287.       while(1){
  288.         display_menu10();              return1=menu_choice10();
  289.         if(return1==-2)                return(-2);
  290.         display_menu10();
  291.         if(return1==1){
  292.         /* we save the help screen and execute the command */
  293.           hide_the_mouse();           save_help_screen();
  294.           show_the_mouse();
  295.       if(menu10==1){
  296.           /* Help about Generalities */
  297.             display_help("GENERALI",0,0,0);     restore_help_screen();
  298.       }
  299.       if(menu10==2){
  300.         /*  */
  301.  
  302.       }
  303.       if(menu10==3){
  304.         /*  */
  305.  
  306.       }
  307.       if(menu10==4){
  308.           /* File menu help */
  309.             display_help("FILES   ",5,0,0);     restore_help_screen();
  310.       }
  311.       if(menu10==5){
  312.         /* Menu 2  */
  313.             display_help("MENU2   ",21,0,0);    restore_help_screen();
  314.       }
  315.       if(menu10==6){
  316.         /* Menu 3  */
  317.             display_help("MENU3   ",32,0,0);    restore_help_screen();
  318.       }
  319.       if(menu10==7){
  320.         /* Menu 4 */
  321.             display_help("MENU4   ",43,0,0);    restore_help_screen();
  322.       }
  323.       if(menu10==8){
  324.         /* Menu 5 */
  325.             display_help("MENU5   ",54,0,0);    restore_help_screen();
  326.       }
  327.       if(menu10==9){
  328.         /* Menu 6 */
  329.             display_help("MENU6   ",65,0,0);    restore_help_screen();
  330.       }
  331.       if(menu10==10){
  332.         /* Menu 7 */
  333.             display_help("MENU7   ",76,0,0);    restore_help_screen();
  334.       }
  335.       if(menu10==11){
  336.         /* Menu 8 */
  337.             display_help("MENU8   ",87,0,0);    restore_help_screen();
  338.       }
  339.       if(menu10==12){
  340.         /* Configuration */
  341.             display_help("CONFIGUR",98,0,0);    restore_help_screen();
  342.       }
  343.     }
  344.       }
  345.     }
  346. /* End of the Module *//*----------------*/
  347.